<?php

class new_goodsControl extends BaseHomeControl{

    function indexOp() {
        $goods_class = Model('goods_class')->getGoodsClassListByParentId(0);
        Tpl::output('goods_class', $goods_class);
        Tpl::showpage("new_goods");
    }

    function floor_newOp(){
        $condition = array();
        $condition['goods_storage'] = ["gt",0];
        $condition['goods_state'] = 1;
        $condition['goods_edittime'] = array( 'gt',strtotime('-7 days') );
        $model = Model('goods');
        $goods = $model->getGoodsList($condition,null,'goods_commonid',null,null,8);

        foreach($goods as $k=>$v){
            $hot_goods[$k]['pic']         = cthumb($v['goods_image']);
            $hot_goods[$k]['link']        = "/shop/index.php?act=goods&op=index&goods_id=".$v['goods_id'];
            $hot_goods[$k]['goods_name']  = $v['goods_name'];
            $hot_goods[$k]['price']       = $v['goods_price'];
        }
        echo json_encode($hot_goods);
    }
}